home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / GETNS.C < prev    next >
Text File  |  1986-05-18  |  896b  |  27 lines

  1. /* 1.2  01-08-86                        (getns.c)
  2.  ************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1986        *
  6.  ************************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "stdtyp.h"
  10. #include "stdio.h"
  11.  
  12. /************************************************************************/
  13.     STRING
  14. getns(p, s, n)        /* Prompt with message p on stdout, then get
  15.                string s of maximum n characters from stdin.
  16.                Return pointer to s.                */
  17. /*----------------------------------------------------------------------*/
  18. STRING p, s;
  19. {
  20.     char line[MAXLINE];
  21.  
  22.     fputs(p, stdout);
  23.     gets(line);
  24.     strncpy(s, line, n);
  25.     return s;
  26. }
  27.